const { Schema, SchemaTypes } = require('../schema');

/**
 * 红包
 */
class Envelope extends Schema {
    PropertyModelDataTemplate () {
        return {
            userId: { type: SchemaTypes.ObjectId, required: true },
            // 满多少，单位：分
            reachAmount: { type: SchemaTypes.Number, required: true },
            // 减多少，单位：分
            amount: { type: SchemaTypes.Number, required: true },
            // 状态
            status: { type: SchemaTypes.Number, required: true },
            // 使用时间
            useTime: { type: SchemaTypes.Number, required: false },

            // 预留，区域id
            areaId: { type: SchemaTypes.ObjectId, required: false },
            createTime: { type: SchemaTypes.Number, required: true, default: require('../../module/tool/time').getCurrentTimestamp() }
        };
    }
}

module.exports = Envelope;
